package net.lwf.hibernate.dao;

import java.util.List;


import net.lwf.exception.ExceptionUtil;
import net.lwf.hibernate.entity.Hangman;
import net.lwf.hibernate.util.HibernateUtil;

import org.hibernate.Criteria;
import org.hibernate.HibernateException;
import org.hibernate.Session;


public class HangmanDAO extends BaseDAO {
	
	@SuppressWarnings("unchecked")
	public List<Hangman> getData() {

		List data = null;
	    Session session = HibernateUtil.getSessionFactory().openSession();
	    try {
	    	Criteria criteria = session.createCriteria(Hangman.class);
	    	data = criteria.list();	
	    }
	    catch(HibernateException hex) {
	    	ExceptionUtil.logAndThrowException(HangmanDAO.class, hex);
	    }
	    finally {
	    	if(session != null) {
	    		session.close();
	    	}
	    }
		return data;
	    
	}

}
